package com.ruoyi.bus.service.impl;

import com.ruoyi.bus.domain.BusWarningRecord;
import com.ruoyi.bus.mapper.BusWarningRecordMapper;
import com.ruoyi.bus.service.IBusWarningRecordService;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 预警记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-09-15
 */
@Service
public class BusWarningRecordServiceImpl implements IBusWarningRecordService 
{
    @Autowired
    private BusWarningRecordMapper busWarningRecordMapper;

    /**
     * 查询预警记录
     * 
     * @param id 预警记录主键
     * @return 预警记录
     */
    @Override
    public BusWarningRecord selectBusWarningRecordById(Long id)
    {
        return busWarningRecordMapper.selectBusWarningRecordById(id);
    }

    /**
     * 查询预警记录列表
     * 
     * @param busWarningRecord 预警记录
     * @return 预警记录
     */
    @Override
    public List<BusWarningRecord> selectBusWarningRecordList(BusWarningRecord busWarningRecord)
    {
        return busWarningRecordMapper.selectBusWarningRecordList(busWarningRecord);
    }

    /**
     * 新增预警记录
     * 
     * @param busWarningRecord 预警记录
     * @return 结果
     */
    @Override
    public int insertBusWarningRecord(BusWarningRecord busWarningRecord)
    {
        busWarningRecord.setCreateTime(DateUtils.getNowDate());
        return busWarningRecordMapper.insertBusWarningRecord(busWarningRecord);
    }

    /**
     * 修改预警记录
     * 
     * @param busWarningRecord 预警记录
     * @return 结果
     */
    @Override
    public int updateBusWarningRecord(BusWarningRecord busWarningRecord)
    {
        busWarningRecord.setUpdateTime(DateUtils.getNowDate());
        return busWarningRecordMapper.updateBusWarningRecord(busWarningRecord);
    }

    /**
     * 批量删除预警记录
     * 
     * @param ids 需要删除的预警记录主键
     * @return 结果
     */
    @Override
    public int deleteBusWarningRecordByIds(String ids)
    {
        return busWarningRecordMapper.deleteBusWarningRecordByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除预警记录信息
     * 
     * @param id 预警记录主键
     * @return 结果
     */
    @Override
    public int deleteBusWarningRecordById(Long id)
    {
        return busWarningRecordMapper.deleteBusWarningRecordById(id);
    }
}
